package com.htfyun.eink.pw.configs;

import android.view.View;

import androidx.annotation.NonNull;

import com.htfyun.eink.pw.core.EinkHelper;
import com.htfyun.eink.pw.core.enums.EinkDataMode;
import com.htfyun.eink.pw.core.enums.EinkShowMode;
import com.htfyun.eink.pw.core.enums.PWA2Gate;
import com.htfyun.eink.pw.core.enums.PWDisplayMode;

/**
 * 配置 刷新模式
 */
public class ConfigFreshMode {

    // view 的 数据模式
    private EinkDataMode viewDataMode = EinkDataMode.A4;
    // view 的 显示模式
    private EinkShowMode viewShowMode = EinkShowMode.GLD;

    //手写 显示模式
    private PWDisplayMode pwDisplayMode = PWDisplayMode.EINKMODE_GLAUTO;
    //手写 PWA2Gate
    private PWA2Gate pwA2Gate = PWA2Gate.EinkA2GateForA16;

    public EinkDataMode getViewDataMode() {
        return viewDataMode;
    }

    public EinkShowMode getViewShowMode() {
        return viewShowMode;
    }

    public ConfigFreshMode setViewDataModeAndShowModeForView(@NonNull View view,
                                                             EinkDataMode viewDataMode,
                                                             EinkShowMode viewShowMode) {
        this.viewDataMode = viewDataMode;
        this.viewShowMode = viewShowMode;
        EinkHelper.setEinkUpdateModeWithView(view,
                getViewDataMode(),
                getViewShowMode());
        return this;
    }

    public PWDisplayMode getPWDisplayMode() {
        return pwDisplayMode;
    }

    public ConfigFreshMode setPWDisplayMode(PWDisplayMode pwDisplayMode) {
        this.pwDisplayMode = pwDisplayMode;
        return this;
    }

    public PWA2Gate getPWA2Gate() {
        return pwA2Gate;
    }

    public ConfigFreshMode setPWA2Gate(PWA2Gate pwA2Gate) {
        this.pwA2Gate = pwA2Gate;
        return this;
    }
}
